<template>
  <el-card class="content">
    <div class="top">
      <div class="avatar">
        <img :src="Touristuser_pic" alt="" srcset="" v-if="Touristuser_pic">
        <img src="../../../assets/images/头像.jpg" alt="" srcset="" v-else>
      </div>
    </div>
    <div class="title">欢迎  {{ Touristusername }}</div>
    <div>
      <el-button type="primary"  size="min" style="margin: auto;display:flex;" @click="logoutFn">退出</el-button>
    </div>
  </el-card>
</template>

<script>
import { mapGetters } from 'vuex';
export default {
  computed: {
    ...mapGetters(['Touristnickname', 'Touristusername', 'Touristuser_pic'])
  },
  data() {
    return {

    };
  },

  mounted() {

  },

  methods: {
    logoutFn() {
      this.$confirm('您确认退出登录吗？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          // TODO：执行退出登录的操作
          this.$store.commit('updateTouristToken', '')
          this.$store.commit('updateTouristInfo', '')
          this.$router.push('/')
        })
        .catch((err) => err)
    }
  },
};
</script>

<style lang="less" scoped>
.content {
  width: 500px;
  display: flex;
  flex-direction: column;

  .top {
    width: 100%;
    height: 80px;
    display: flex;
    justify-content: center;

    .avatar {
      width: 80px;
      height: 80px;
      border-radius: 90px;
      background-color: red;

      img {
        width: 100%;
        height: 100%;
        border-radius: 90px;
      }
    }
  }

  .title {
    width: 100%;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
}
</style>